<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2020/10/12
 * Time: 4:06 PM
 */
namespace app\admin\logic;

use app\model\SuppliesApply;
use think\facade\Request;

class ApplyLogic
{

    public function getList()
    {
        $param = Request::get();

        $where = [
            ['sa_status','=',1],
            ['sa_orgid','=',config('user')['orgid']]
        ];

        if(isset($param['startTime']) && !empty($param['startTime'])){
            $where[] = ['sa_create_time','>=',strtotime(date('Y-m-d',$param['startTime']))];
        }

        if(isset($param['endTime']) && !empty($param['endTime'])){
            $where[] = ['sa_create_time','<=',strtotime(date('Y-m-d 23:59:59',$param['endTime']))];
        }

        $applyModel = new SuppliesApply();
        return $applyModel->getApplyDetailListByCondition($where);
    }

}